<?php

namespace App\Library\Requests\Auction;

use App\Library\Requests\Base\BasePageRequest;
use App\Library\Rules\LikeRule;

class AuctionPageRequest extends BasePageRequest
{
    public function rules(): array
    {
        $array = parent::rules();
        $array['sortColumn'] .= '|in:id,createdAt';
        return array_merge($array, [
            'status' => 'nullable|integer|in:0,1',
            'auditStatus' => 'nullable|integer|between:0,2',
            'sellOut' => 'nullable|integer|in:0,1',
            'isStart' => 'nullable|integer|in:0,1',
            'isEnd' => 'nullable|integer|in:0,1',
            'expired' => 'nullable|integer|in:0,1',
            'title' => ['nullable', 'string', 'max:30', new LikeRule],
            'startAt' => 'nullable|date|date_format:Y-m-d H:i:s',
            'endAt' => 'nullable|date|date_format:Y-m-d H:i:s',
        ]);
    }
}
